package com.cac.demo.util.adapter;

import com.cac.yiyan.common.util.StringUtil;

import java.io.Serializable;

/**
 * @className: QueryReqBean
 * @description: （描述这个类的作用）
 * @author:
 * @date: 2024/6/22 11:03:03 周六
 * @version: 1.0
 */
public class QueryReqBean<T> implements Serializable {

    private static final long serialVersionUID = 1L;
    private PageParameter pageParameter = null;
    private T searchParams = null;
    private String sortExp = null;
    private String sidx = null;
    private String sord = null;
    private String keyWord = null;

    public QueryReqBean() {
    }

    public PageParameter getPageParameter() {
        if (this.pageParameter == null) {
            this.pageParameter = new PageParameter();
        }

        return this.pageParameter;
    }

    public void setPageParameter(PageParameter pageParameter) {
        this.pageParameter = pageParameter;
        this.sidx = pageParameter.getOrder();
        this.sord = pageParameter.getSort();
        if (StringUtil.hasText(this.sidx)) {
            this.sortExp = this.sidx + " ";
            if (StringUtil.hasText(this.sord)) {
                this.sortExp = this.sortExp + this.sord + " ";
            }
        }

    }

    public T getSearchParams() {
        return this.searchParams;
    }

    public void setSearchParams(T searchParams) {
        this.searchParams = searchParams;
    }

    public String getSortExp() {
        return this.sortExp;
    }

    public void setSortExp(String sortExp) {
        this.sortExp = sortExp;
    }

    public String getSidx() {
        return this.sidx;
    }

    public void setSidx(String sidx) {
        this.sidx = sidx;
    }

    public String getSord() {
        return this.sord;
    }

    public void setSord(String sord) {
        this.sord = sord;
    }

    public String getKeyWord() {
        return this.keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("QueryReqBean [pageParameter=");
        builder.append(this.pageParameter);
        builder.append(", searchParams=");
        builder.append(this.searchParams);
        builder.append(", sortExp=");
        builder.append(this.sortExp);
        builder.append("]");
        return builder.toString();
    }
}
